import { createRouter, createWebHistory } from "vue-router";

import Layout from '@/views/Layout/index.vue'
import Login from '@/views/Login/index.vue'

import Home from '@/views/Home/index.vue'
import Detail from '@/views/Detail/index.vue'
import Category from '@/views/Category/index.vue'
import Cart from '@/views/Category/index.vue'
import Member from '@/views/Member/index.vue'
import Checkout from '@/views/Checkout/index.vue'
import PageNotFound from '@/views/PageNotFound/index.vue'

const router = createRouter({
  history: createWebHistory('/'),
  routes: [
    { path: '/login', component: Login },
    {
      path: '/',
      component: Layout,
      redirect: '/home',
      children: [
        { path: '/home', component: Home },
        { path: '/detail', component: Detail },
        { path: '/category/:id', component: Category },
        { path: '/cart', component: Cart },
        { path: '/member', component: Member },
        { path: '/checkout', component: Checkout }
      ]
    },
    { path: '/:pathMatch(.*)*', component: PageNotFound }
  ]
})

export default router